package nihe;
import nihe.*;
public class ZhiXian
{
	int j;
	double a,b;
	double a1=0,a2=0,b1=0,b2=0,d1=0,d2=0;
	double db1[]=new double[ShuRu.i];
	double db2[]=new double[ShuRu.i];
	double db3[]=new double[ShuRu.i];
	public ZhiXian()
	{
		for(j=0;j<ShuRu.i;j++)
		{
			db1[j]=ShuRu.db1[j];
			db2[j]=ShuRu.db2[j];
		}


		for(j=0;j<db1.length;j++)
		{
			a1=a1+db1[j]*db1[j];
			a2=a2+db1[j];
			b1=a2;
			b2=db1.length;
			d1=d1+db1[j]*db2[j];
			d2=d2+(-db2[j]);
		}

		a=(b1*d2-d1*b2)/(a1*b2-b1*a2);
		b=(a1*d2-d1*a2)/(a1*b2-b1*a2);
		for(j=0;j<db3.length;j++)
		{
			db3[j]=a*db1[j]+b;
		}
	}

}